import Cookies from 'js-cookie'

const AccessTokenKey = 'mips_access_token'
const RefreshTokenKey = 'mips_refresh_token'

export function getAccessToken() {
  return Cookies.get(AccessTokenKey)
}

export function setAccessToken(token) {
  if (!token) {
    return Cookies.remove(AccessTokenKey)
  }
  return Cookies.set(AccessTokenKey, token)
}

export function getRefreshToken() {
  return Cookies.get(RefreshTokenKey)
}

export function setRefreshToken(token) {
  if (!token) {
    return Cookies.remove(RefreshTokenKey)
  }
  return Cookies.set(RefreshTokenKey, token)
}

